using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Home.Site.Properties;

namespace Home.Site.Models.Account
{
    [Table("UserProfile")]
    public class UserProfile
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int UserId { get; set; }
        public string UserName { get; set; }
        public string LastName { get; set; }
        public string ShowName { get; set; }
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }
        [DataType(DataType.ImageUrl)]
        public string Gravatar { get; set; }
        public string Other { get; set; }
        public DateTime? RegistrationTime { get; set; }
        public bool IsRoot { get; set; }
        public bool IsAdmin { get; set; }
        public bool IsOperator { get; set; }
    }

    public class RegisterExternalLoginModel
    {
        [Required]
        [Display(ResourceType = typeof (Resources), Name = "UserName")]
        public string UserName { get; set; }
        public string ExternalLoginData { get; set; }
    }

    public class LocalPasswordModel
    {
        [Required]
        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "LocalPassword")]
        public string OldPassword { get; set; }
        [Required]
        [StringLength(100, ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "LocalPasswordModel_NewPassword", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "NewPassword")]
        public string NewPassword { get; set; }
        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "ConfirmPassword")]
        [Compare("NewPassword", ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "LocalPasswordModel_ConfirmPassword")]
        public string ConfirmPassword { get; set; }
        public string UserName { get; set; }
        public string LastName { get; set; }
        public string ShowName { get; set; }
        [DataType(DataType.EmailAddress)]
        public string Email { get; set; }
        [DataType(DataType.ImageUrl)]
        public string Gravatar { get; set; }
        public string Other { get; set; }
        public bool IsRoot { get; set; }
        public bool IsAdmin { get; set; }
        public bool IsOperator { get; set; }
    }

    public class LoginModel
    {
        [Required]
        [Display(ResourceType = typeof (Resources), Name = "UserName")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "Password")]
        public string Password { get; set; }

        [Display(ResourceType = typeof (Resources), Name = "RememberMe")]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {
        [Required]
        [Display(ResourceType = typeof (Resources), Name = "UserName")]
        public string UserName { get; set; }

        [Required]
        [StringLength(100, ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "LocalPasswordModel_NewPassword", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(ResourceType = typeof (Resources), Name = "ConfirmPassword")]
        [Compare("Password", ErrorMessageResourceType = typeof (Resources), ErrorMessageResourceName = "ConfirmPassword_The_password_and_confirmation_password_do_not_match_")]
        public string ConfirmPassword { get; set; }
    }

    public class ExternalLogin
    {
        public string Provider { get; set; }
        public string ProviderDisplayName { get; set; }
        public string ProviderUserId { get; set; }
    }
}
